<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
    订单详情
    <small></small>
</h3>
<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <i class="fa fa-home"></i>
            <a href="index.html">Home</a>
            <i class="fa fa-angle-right"></i>
        </li>
        <li>
            <a href="#">订单管理</a>
            <i class="fa fa-angle-right"></i>
        </li>
        <li>
            <a href="#">订单详情</a>
        </li>
    </ul>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
    <div class="col-md-12">
        <form class="form-horizontal form-row-seperated" action="#" id="edit_form">
            <div class="portlet">
                <div class="portlet-title">
                    <div class="caption">
                        <i class="fa fa-shopping-cart"></i>订单详情
                    </div>
                    <div class="actions btn-set">
                        <?php if ($data['status'] === \Lib\Consts::ORDER_STATUS_PAY) { ?>
                        <button type="button" class="btn red refundSubmit">
                            <i class="fa fa-check"></i> 强制退款
                        </button>
                        <?php } ?>
                        <button type="button" id="back" class="btn default">
                            <i class="fa fa-angle-left"></i> 返回
                        </button>
                        <!--button class="btn default">
                            <i class="fa fa-reply"></i> 重置
                        </button>
                        <button type="button" class="btn green table-group-action-submit">
                            <i class="fa fa-check"></i> 保存
                        </button>
                        <button class="btn green"><i class="fa fa-check-circle"></i> 保存 & 继续编辑</button>-->
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="tabbable">

                        <div class="tab-content no-space">
                            <div class="tab-pane active" id="tab_general">
                                <div class="form-body">
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">
                                            订单ID: <span class="required">* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <input disabled type="text" class="form-control" name="game" placeholder="" value="<?php echo $data['order_no'];?>">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">
                                            发布者: <span class="required">* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <input disabled type="text" class="form-control" name="fromNickName" value="<?php echo $data['from_nick_name']; ?>" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">
                                            客户: <span class="required">* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <input disabled type="text" class="form-control" name="toNickName" value="<?php echo $data['to_nick_name']; ?>" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">
                                            价格: <span class="required">* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <input disabled type="text" class="form-control" name="price" placeholder="" value="<?php echo $data['price']; ?>" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">状态: <span class="required">
													* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <input disabled type="text" class="form-control" name="status" value="<?php
                                            switch($data['status']){
                                                case 1: echo '待支付'; break;
                                                case 2: echo '已支付'; break;
                                                case 3: echo '退款中'; break;
                                                case 4: echo '拒绝退款'; break;
                                                case 5: echo '已退款'; break;
                                                case 6: echo '已完成'; break;
                                                case 7: echo '已评价'; break;
                                                case 8: echo '已关闭'; break;
                                                case 9: echo '删除状态'; break;
                                            }
                                            ?>" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">
                                            交易时间: <span class="required">* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <input disabled type="text" class="form-control" name="addTime" placeholder="" value="<?php echo date('Y-m-d H:i:s',$data['add_time']); ?>" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-2 control-label">
                                            购买时段: <span class="required">* </span>
                                        </label>
                                        <div class="col-md-10">
                                            <table class="table">
                                                <thead>
                                                <tr>
                                                    <th>
                                                        发布ID
                                                    </th>
                                                    <th>
                                                        指定游戏
                                                    </th>
                                                    <th>
                                                        游戏服务器
                                                    </th>
                                                    <th>
                                                        时间段
                                                    </th>
                                                    <th>
                                                        价格
                                                    </th>
                                                    <th>
                                                        发布时间
                                                    </th>
                                                    <th>
                                                        指定网吧
                                                    </th>
                                                    <th>
                                                        宣言
                                                    </th>
                                                    <th>
                                                        游戏水平
                                                    </th>
                                                    <th>
                                                        更新时间
                                                    </th>
                                                    <th>
                                                        状态
                                                    </th>
                                                </tr>
                                                <?php foreach($detail as $value){?>
                                                <tr>
                                                    <td>
                                                        <?php echo $value['id']; ?>
                                                    </td>
                                                    <td>
                                                        <?php echo $value['game_name']; ?>
                                                    </td>
                                                    <td>
                                                        <?php echo $value['game_server'];?>
                                                    </td>
                                                    <td>
                                                        <?php echo date('Y-m-d H:i:s',$value['begin_time']).' - '.date('Y-m-d H:i:s',$value['end_time']);?>
                                                    </td>
                                                    <td>
                                                        <?php echo $value['price'] ?>
                                                    </td>
                                                    <td>
                                                        <?php echo date('Y-m-d H:i:s',$value['add_time']);?>
                                                    </td>
                                                    <td>
                                                        <?php echo $value['net_bar']; ?>
                                                    </td>
                                                    <td>
                                                        <?php echo $value['manifesto'];?>
                                                    </td>
                                                    <td>
                                                        <?php echo $value['game_level'];?>
                                                    </td>
                                                    <td>
                                                        <?php if($value['update_time'] > 0){echo date('Y-m-d H:i:s',$value['update_time']);}?>
                                                    </td>
                                                    <td>
                                                        <?php if($value['status']==1 && $value['end_time'] > time() ){ ?>
                                                            <span class="label label-sm label-warning">正常</span>
                                                        <?php } elseif($value['status']==2){ ?>
                                                            <span class="label label-sm label-success">已交易</span>
                                                        <?php }elseif($value['status']==3){?>
                                                            <span class="label label-sm label-danger">删除</span>
                                                        <?php }else{?>
                                                            <span class="label label-sm label-danger">过期</span>
                                                        <?php }?>
                                                    </td>
                                                </tr>
                                                <?php } ?>
                                                </thead>
                                            </table>
                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- END PAGE CONTENT-->
<script type="text/javascript" charset="utf-8" src="/plugins/editor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/plugins/editor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/plugins/editor/lang/zh-cn/zh-cn.js"></script>
<script>
    (function(){
//        var editor = UE.getEditor('editor',{'toolbars':[['link','unlink','bold','forecolor']],'autoHeightEnabled':false});
        var editor = UE.getEditor('editor',{
            'autoHeightEnabled':false,
        });
        var textarea = document.getElementById('content');
        editor.ready(function(){
            editor.setContent(textarea.value);
        });
        editor.addListener("contentChange",function(){
            textarea.value = editor.getContent();
        });
    })();

    $(".refundSubmit").click(function(){
        $.ajax({
            type:'POST',
            url:'/admin/refund/force/',
            data: 'order_id=' + <?php echo $data['id'];?>,
            dataType:'json',
            success: function (jsonData) {
                if (jsonData.status == true) {
                    Metronic.alert({
                        type: 'success',
                        icon: '',
                        message: jsonData.msg,
                        container: '',
                        place: 'prepend'
                    });
                    setTimeout(function () {
                        window.location.href = '/admin/order/list?type=buy';
                    }, 2500);
                } else {
                    Metronic.alert({
                        type: 'danger',
                        icon: 'warning',
                        message: jsonData.msg,
                        container: '',//grid.getTableWrapper(),
                        place: 'prepend'
                    });
                }
            },
            error: function (jsonData) {
                Metronic.alert({
                    type: 'danger',
                    icon: 'warning',
                    message: '异常',
                    container: '',
                    place: 'prepend'
                });
            }
        });
    });
</script>